﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KLY.DataModels;
using KLY.Tools;

namespace KLY.ServiceCore
{
    public class Logout : ServiceBase<LogoutRequest, LogoutResponse>
    {
        public override LogoutResponse Process()
        {
            var authToken = BizCommon.GetAuthToken();
            if (string.IsNullOrWhiteSpace(authToken))
            {
                return new LogoutResponse
                {
                    Ok = false
                };
            }
            base.Url = string.Format("http://{0}/v1/api/101013/", BizCommon.Domain);
            base.Method = HttpMethod.POST;
            base.ListHead = new List<RequestHead>
                {
                    new RequestHead
                    {
                        HeaderName="version",
                        HeaderValue="1.0.0"
                    },
                    new RequestHead
                    {
                        HeaderName = "auth-token",
                        HeaderValue= authToken
                    }
                };
            return base.Process();
        }
    }
}
